<template>
	<view class="Wallet">
		<u-navbar :auto-back="true" title="我的钱包" :placeholder="true" bg-color="#F6F8FA"></u-navbar>
		<view class="wallet_box">
			<view class="wallet_main">
				<view class="wallet_content">
					<view class="flex_box flex_row_between flex_col_top">
						<view class="wallet_text">我的余额</view>
						<u-button throttleTime="1000" @click="$goUrl('/pages/mine/agent/cash','to')" shape="circle" color="#FFD95D" text="提现" :custom-style="btnStyle"></u-button>
					</view>
					<view class="wallet_money">￥<text>{{money}}</text></view>
				</view>
				<view @click="$goUrl('/pages/mine/agent/record','to')" class="flex_box flex_row_between wallet_option">
					<view class="wallet_option_name">钱包流水</view>
					<u-icon name="arrow-right" color="#1E272E"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { agentIndex } from '@/common/http.api.js';
	let that;
	export default {
		data() {
			return {
				money: '',
				btnStyle: {
					width: '128rpx',
					height: '68rpx',
					color: '#1E272E',
					margin: '0'
				}
			}
		},
		onLoad() {
			that = this;
		},
		onShow() {
			that.agentIndex();
		},
		methods: {
			agentIndex() {
				agentIndex({params: {agent_token: that.agentInfo.agent_token}})
					.then(res => {
						that.money = res.data.money
					})
					.catch(err => {
						uni.$u.toast(err.msg);
					});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.Wallet{
		min-height: 100vh;
		background-color: #F6F8FA;
		.wallet_box{
			padding: 36rpx;
			.wallet_main{
				background-color: #ffffff;
				border-radius: 24rpx;
				overflow: hidden;
				.wallet_content{
					height: 321rpx;
					background: url('~@/static/money.png') 100% 100%;
					padding: 68rpx 48rpx 0;
					.wallet_text{
						font-size: 28rpx;
						color: #1E272E;
						font-weight: bold;
						line-height: 40rpx;
					}
					.wallet_money{
						padding-top: 24rpx;
						font-size: 36rpx;
						color: #ffffff;
						font-weight: bold;
						line-height: 88rpx;
						text{
							font-size: 72rpx;
						}
					}
				}
				.wallet_option{
					height: 88rpx;
					padding: 0 48rpx;
					.wallet_option_name{
						font-size: 28rpx;
						color: #1E272E;
						font-weight: bold;
					}
				}
			}
		}
	}
</style>
